((*fb)->fish.processings - (*fa)->fish.processings);
}
+static const char *cache_header (void)
+{
+ static char buf[2048];
+ sprintf (buf, "#%s BABL_PATH_LENGTH=%d BABL_TOLERANCE=%f",
+ BABL_GIT_VERSION, _babl_max_path_len (), _babl_legal_error ());
+ return buf;
+}
+
void babl_store_db (void)
{
BablDb *db = babl_fish_db ();
FILE *dbfile = fopen (fish_cache_path (), "w");
if (!dbfile)
return;
- fprintf (dbfile, "#%s BABL_PATH_LENGTH=%d BABL_TOLERANCE=%f\n",
- BABL_GIT_VERSION, _babl_max_path_len (), _babl_legal_error ());
+ fprintf (dbfile, "%s\n", cache_header ());
/* sort the list of fishes by usage, making next run more efficient -
* and the data easier to approach as data for targeted optimization
case '#':
/* if babl has changed in git .. drop whole cache */
{
- char buf[2048];
- sprintf (buf, "#%s BABL_PATH_LENGTH=%d BABL_TOLERANCE=%f",
- BABL_GIT_VERSION, _babl_max_path_len (), _babl_legal_error ());
- if (strcmp ( token, buf))
+ if (strcmp ( token, cache_header ()))
{
free (contents);
return;